﻿Imports System.Data
Imports System.Data.SqlClient



Public Class SqlDataSource


    Public Shared ConnectionString As String _
        = "Data Source=loclahost;Initial Catalog=SponsorshipManager;Integrated Security=True"


    Public Shared Function GetDataTableSP(ByVal sCommandText As String) As DataTable

        Dim rd As SqlDataReader
        Dim cmd As New SqlCommand
        Dim dt As New DataTable

        Using cn As New SqlConnection(ConnectionString)
            cmd.Connection.Open()
            cmd.CommandType = CommandType.StoredProcedure
            cmd.CommandText = sCommandText
            rd = cmd.ExecuteReader()
        End Using

        dt.Load(rd)
        Return dt
End Class
